<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>2.关闭顶部广告（直接隐藏即可）</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        .head-news {
            position: fixed;
            left: 170px;
            width: 1024px;
            height: 60px;
            overflow: hidden;
        }

        i {
            position: absolute;
            top: 0;
            right: 0;
            font-style: normal;
            width: 10px;
            height: 10px;
            text-align: center;
            line-height: 8px;
            color: #bbb;
            border: 1px solid #bbb;
            cursor: pointer;
        }
    </style>
</head>
<!-- 顶部广广告 按钮关闭广告 -->

<body>
    <div class="head-news">
        <img src="images/head-img-1.jpg" alt="">
        <i>x</i>
    </div>
    <script>
        var close = document.querySelector('i');
        var headNews = document.querySelector('.head-news');
        close.onclick = function () {
            headNews.style.display = 'none';
        }
    </script>
</body>

</html>